import pandas as pd
import numpy as py
import matplotlib.pyplot as plt
from sklearn import model_selection
from sklearn.cluster import KMeans
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.preprocessing import LabelEncoder

df = pd.read_csv('employee_data.csv')
print(df)

le = LabelEncoder()
df['Departments'] = le.fit_transform(df['Departments'])
df['salary'] = le.fit_transform(df['salary'])
print(df)

X = df[['satisfaction_level', 'last_evaluation', 'number_project',
        'average_monthly_hours', 'time_spend_company', 'Work_accident',
        'promotion_last_5years', 'Departments', 'salary']]
y = df['left']

X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, test_size=0.25)
clf = GradientBoostingClassifier(n_estimators=100,
                                 learning_rate=1.0,
                                 max_depth=1,
                                 random_state=0).fit(X_train, y_train)
print(clf.score(X_test, y_test))
